import { AnimatorStateLogic } from "../../../../../../extensions/oops-plugin-framework/assets/libs/animator/core/AnimatorStateLogic";
import { Role } from "../../Role";
import { AnimationEventHandler } from "./AnimationEventHandler";

/** 受击状态逻辑 */
export class RoleStateDead extends AnimatorStateLogic {
    private role: Role;
    private anim: AnimationEventHandler;

    public constructor(role: Role, anim: AnimationEventHandler) {
        super();
        this.role = role;
        this.anim = anim;
        this.anim.addFinishedEvent("die", this.onDead, this);
        // this.anim.addFrameEvent("die", this.onDead, this);
    }

    private onDead() {
        var onDieComplete = this.role.RoleView.animator.onDieComplete;
        onDieComplete && onDieComplete();
    }

    public onEntry() {

    }

    public onUpdate() {

    }

    public onExit() {
    }
}

